.PHONY:all
all:libmylib.so libmylib.a

libmylib.so:d_myprint.o d_mymath.o
	gcc -shared -o $@ $^
d_myprint.o:myprint.c
	gcc -c -fPIC -o $@ $^
d_mymath.o:mymath.c
	gcc -c -fPIC -o $@ $^

libmylib.a:s_myprint.o s_mymath.o
	ar -rc $@ $^
s_myprint.o:myprint.c
	gcc -c -o $@ $^
s_mymath.o:mymath.c
	gcc -c -o $@ $^

.PHONY:release
release:
	mkdir -p ./mylib/include ./mylib/lib
	cp ./*.h ./mylib/include
	cp ./*.a ./mylib/lib
	cp ./*.so ./mylib/lib

.PHONY:clean
clean:
	rm -rf ./*.o ./*.a ./*.so mylib
